package com.sxbbc.common.core.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sxbbc.common.basics.utils.calculation.CalcuUtils;
import com.sxbbc.common.basics.utils.statics.StaticUtils;
import com.sxbbc.common.core.entity.jz.BMoneyDetail;
import com.sxbbc.common.core.enums.HandleTypeEnums;
import com.sxbbc.common.core.mapper.jz.BMoneyDetailMapper;
import com.sxbbc.common.core.service.IBMoneyDetailService;
import com.sxbbc.common.core.utils.BasePage;

/**
 * <p>
 * 店铺金额明细表 服务实现类
 * </p>
 *
 * @author xiaoky
 * @since 2019-06-04
 */
@Service
public class BMoneyDetailServiceImpl extends ServiceImpl<BMoneyDetailMapper, BMoneyDetail> implements IBMoneyDetailService {
	@Autowired
	private BMoneyDetailMapper bMoneyDetailMapper;
	@Override
	public IPage<BMoneyDetail> queryBusinessMoneyDetail(BasePage<BMoneyDetail> page, BMoneyDetail moneyDetail) {
		IPage<BMoneyDetail> pageInfo = bMoneyDetailMapper.queryBusinessMoneyDetail(page, moneyDetail);
		for (BMoneyDetail detail : pageInfo.getRecords()) {
			if (CalcuUtils.getInstance().isEquals(detail.getTypeId(), HandleTypeEnums.CASH.getId())) {
        		detail.setCash(StaticUtils.STATUS_YES);
        	}
			detail.setTypeName(HandleTypeEnums.getName(detail.getTypeId()));
		}
		return pageInfo;
	}

}
